home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / J-M / MenuUtils.cpt / Transfer Menu / background_2662.txt < prev    next >
Text File  |  1989-04-13  |  11KB  |  356 lines

  1. -- background: 2662 from stack: in
  2. -- bmap block id: 3080
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: 
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 00
  10. -- high flags: A000
  11. -- rect: left=60 top=92 right=111 bottom=246
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Transfer Menu Demo
  20. ----- HyperTalk script -----
  21. on mouseDown
  22.   get HPopupMenu(cd fld "xtransfer",0,item 2 of the rect of the target+3,item 3 of the rect of the target-3)
  23.   go this cd
  24.   set cursor to watch
  25.   if item 1 of it = 1 then
  26.     set hilite of me to false
  27.     visual iris close
  28.     go to stack item (item 2 of it) of line (item 1 of it) of cd fld "xtransfer" of first cd
  29.   else if item 1 of it = 3 then
  30.     set hilite of me to false
  31.     visual zoom open
  32.     go this cd
  33.     get item (item 2 of it) of line (item 1 of it) of cd fld "xtransfer" of first cd
  34.     if "FontDA" is in it
  35.     then get Strings("ReplacePhrase","FontDA","Font/DA", it)
  36.     if "ReadySet" is in it
  37.     then get Strings("ReplacePhrase","ReadySet","Ready,Set,", it)
  38.     open it
  39.   else if item 1 of it = 5 then
  40.     resetStackList
  41.   else if item 1 of it = 6 then resetApplicationList
  42. end mouseDown
  43. on resetStackList
  44.   global stacks
  45.   put "Stacks," & getCurrentFiles("STAK",stacks) into line 1 of cd fld "xtransfer"
  46. end resetStackList
  47. on resetApplicationList
  48.   global applications
  49.   put "Applications," & getCurrentFiles("APPL",applications) into line 3 of cd fld "xtransfer"
  50. end resetApplicationList
  51. function getCurrentFiles type, typeList
  52. set cursor to busy
  53. if first word of typeList is empty then return "(Not Available"
  54. put empty into currentList
  55. repeat with N = 1 to the number of lines in typeList
  56.   set cursor to busy
  57.   if first word of line N of typeList is not empty then
  58.     if last char of line N of typeList is not ":" then put ":" after line N of typeList
  59.     get files(line N of typeList,type)
  60.     if it is not empty then
  61.       if "," is in it then get Strings("DeleteChar",",", it)
  62.       if "/" is in it then get Strings("DeleteChar", "/", it)
  63.       put it & return after currentList
  64.     end if
  65.   end if
  66. end repeat
  67. delete last char of currentList
  68. if first word of currentList is empty then return "(Not Available"
  69. if the number of lines in currentList > 1 then
  70.   put Strings("ReplaceChar", numToChar(13), ",", currentList) into currentList
  71.   put Strings("SortItems", currentList) into currentList
  72. end if
  73. return currentList
  74. end getCurrentFiles
  75.  
  76.  
  77. -- part 2 (button)
  78. -- low flags: 00
  79. -- high flags: A000
  80. -- rect: left=60 top=159 right=177 bottom=246
  81. -- title width / last selected line: 0
  82. -- icon id / first selected line: 0 / 0
  83. -- text alignment: 0
  84. -- font id: 0
  85. -- text size: 12
  86. -- style flags: 0
  87. -- line height: 16
  88. -- part name: About Transfer Menu...
  89. ----- HyperTalk script -----
  90. on mouseUp
  91.   hide cd fld "about transfer"
  92. end mouseUp
  93. on mouseDown
  94.   show cd fld "about transfer"
  95. end mouseDown
  96. on mouseLeave
  97.   hide cd fld "about transfer"
  98. end mouseLeave
  99.  
  100.  
  101. -- part 3 (button)
  102. -- low flags: 00
  103. -- high flags: A000
  104. -- rect: left=60 top=111 right=128 bottom=246
  105. -- title width / last selected line: 0
  106. -- icon id / first selected line: 0 / 0
  107. -- text alignment: 0
  108. -- font id: 0
  109. -- text size: 12
  110. -- style flags: 0
  111. -- line height: 16
  112. -- part name: Menu Installer
  113. ----- HyperTalk script -----
  114. on mouseDown
  115.   global btnLevel,btnType,btnFont,btnSize,btnSide
  116.   get cd fld "options"
  117.   put numToChar(18) before item btnLevel of line 1 of it
  118.   put numToChar(18) before item btnType of line 2 of it
  119.   put numToChar(18) before item btnFont of line 3 of it
  120.   put numToChar(18) before item btnSize of line 4 of it
  121.   put numToChar(18) before item btnSide of line 5 of it
  122.   get HPopupMenu(it,0,item 2 of the rect of the target+1,item 3 of the rect of the target-3)
  123.   set cursor to watch
  124.   go this cd
  125.   if item 1 of it > 0 and item 1 of it < 7 then
  126.     resetCheckedItem item 1 of it, item 2 of it
  127.   else if item 1 of it = 7 then
  128.     visual zoom close
  129.     lock screen
  130.     unlock screen with zoom open
  131.     put SFile("GetFile","STAK","the stack to install ‚ÄòTransfer Menu‚Äô") into fName
  132.     set cursor to watch
  133.     if fName is empty then exit mouseDown
  134.     installButton fName
  135.   end if
  136. end mouseDown
  137. on resetCheckedItem lineNR, newLevel
  138.   global btnLevel,btnType,btnFont,btnSize,btnSide
  139.   put item lineNR of "btnLevel,btnType,btnFont,btnSize,btnSide" into varName
  140.   put Strings("GetGlobal",varName) into oldLevel
  141.   put "   " before item oldLevel of line lineNR of cd fld "options"
  142.   put first word of item newLevel of line lineNR of cd fld "options" & "       " into item newLevel of line lineNR of cd fld "options"
  143.   get Strings("SetGlobal",varName,newLevel)
  144. end resetCheckedItem
  145. on installButton toFile
  146.   global btnLevel,btnType,btnFont,btnSize,btnSide
  147.   set cursor to watch
  148.   put "...checking the stack you selected.  Please wait a second."
  149.   lock screen
  150.   set lockMessages to true
  151.   push cd
  152.   go stack toFile
  153.   put 0 into temp
  154.   if the number of cd flds > 0 then
  155.     repeat with N = 1 to the number of cd flds
  156.       if "xtransfer" is in short name of cd fld N then
  157.         show cd fld N
  158.         choose fld tool
  159.         click at the loc of cd fld N
  160.         doMenu "Cut Field"
  161.         choose browse tool
  162.       end if
  163.     end repeat
  164.   end if
  165.   pop cd
  166.   set lockMessages to false
  167.   unlock screen
  168.   hide msg
  169.   ask "Please name your new 'Transfer' button:" with "Transfer"
  170.   if it is empty then exit installButton
  171.   put it into buttonName
  172.   put "...transferring resources.  Please wait."
  173.   put the long name of this stack into fromFile
  174.   put word 2 to 50 of fromFile into fromFile
  175.   delete char 1 of fromFile
  176.   delete last char of fromFile
  177.   if not moveResources(fromFile,toFile) then exit installButton
  178.   put "...resource installation successful! Stand by, please"
  179.   put item btnType of ",card,bkgnd" into buttonLevel
  180.   put item btnLevel of ",shadow,transparent,opaque,rectangle" into buttonStyle
  181.   put item btnFont of ",Chicago,Geneva,Monaco,New York" into buttonFont
  182.   put item btnSize of ",9,10,12,18,24" into buttonSize
  183.   put cd fld "protoField" into protoField
  184.   put cd fld "protoScript" into theScript
  185.   put line 1 of cd fld (item btnSide of ",bottom,right,center") into line 2 of theScript
  186.   set hilite of the target to false
  187.   closeCard
  188.   set lockMessages to true
  189.   visual barn door open
  190.   go stack toFile
  191.   lock screen
  192.   put Strings("ReplaceWord","xxxx",last word of the id of this cd,theScript) into theScript
  193.   get the number of cd flds + 1
  194.   doMenu "New Field"
  195.   hide cd fld it
  196.   set name of cd fld it to "xtransfer"
  197.   put protoField into cd fld it
  198.   if buttonLevel is "bkgnd" then
  199.     doMenu "Background"
  200.     get the number of bg btns + 1
  201.     doMenu "New Button"
  202.     set name of bg btn it to buttonName
  203.     set style of bg btn it to buttonStyle
  204.     set textFont of bg btn it to buttonFont
  205.     set textSize of bg btn it to buttonSize
  206.     set script of bg btn it to theScript
  207.     doMenu "Background"
  208.   else
  209.     get the number of cd btns + 1
  210.     doMenu "New Button"
  211.     set name of cd btn it to buttonName
  212.     set style of cd btn it to buttonStyle
  213.     set textFont of cd btn it to buttonFont
  214.     set textSize of cd btn it to buttonSize
  215.     set script of cd btn it to theScript
  216.   end if
  217.   choose browse tool
  218.   unlock screen
  219.   beep 3
  220.   if buttonLevel is "bkgnd" then
  221.     repeat 3
  222.       set hilite of bg btn buttonName to true
  223.       set hilite of bg btn buttonName to false
  224.     end repeat
  225.   else
  226.     repeat 3
  227.       set hilite of cd btn buttonName to true
  228.       set hilite of cd btn buttonName to false
  229.     end repeat
  230.   end if
  231.   put "please move '" & buttonName & "' button to the desired location..."
  232.   wait 3 secs
  233.   put "...then type 'Command-Tab' (wait, there‚Äôs more)"
  234.   wait 3 secs
  235.   put "you have to Restart HyperCard before the button will work"
  236.   wait 3 secs
  237.   put "...we're done playin', now!"
  238.   wait 1 second
  239.   hide msg
  240.   choose btn tool
  241.   if buttonLevel is "bkgnd" then
  242.     click at the loc of bg btn buttonName
  243.   else click at the loc of cd btn buttonName
  244. end installButton
  245. function moveResources fromFile,toFile
  246. if not copyResources(fromFile,toFile) then
  247.   hide msg
  248.   beep
  249.   answer "Sorry, there was a problem transferring resources. Please try again." with "Cancel"
  250.   return false
  251. else return true
  252. end moveResources
  253. function copyResources fromFile,toFile
  254. ResCopy fromFile,toFile,"XFCN","Strings"
  255. if "error" is in the result then return false
  256. ResCopy fromFile,toFile,"XFCN","SFile"
  257. if "error" is in the result then return false
  258. ResCopy fromFile,toFile,"XFCN","Files"
  259. if "error" is in the result then return false
  260. ResCopy fromFile,toFile,"XFCN","HPopUpMenu"
  261. if "error" is in the result then
  262.   return false
  263. else return true
  264. end copyResources
  265.  
  266.  
  267.  
  268. -- part 4 (button)
  269. -- low flags: 00
  270. -- high flags: E000
  271. -- rect: left=60 top=126 right=144 bottom=246
  272. -- title width / last selected line: 0
  273. -- icon id / first selected line: 0 / 0
  274. -- text alignment: 0
  275. -- font id: 0
  276. -- text size: 12
  277. -- style flags: 0
  278. -- line height: 16
  279. -- part name: More FREEware & S/W...
  280. ----- HyperTalk script -----
  281. on mouseUp
  282.   set hilite of me to true
  283.   if not visible of cd fld "freeware" then
  284.     repeat 2
  285.       set hilite of me to false
  286.       set hilite of me to true
  287.     end repeat
  288.     click at 465,72
  289.     lock screen
  290.     show cd fld "freeware"
  291.     unlock screen with zoom open
  292.   else send mouseUp to cd fld "freeware"
  293. end mouseUp
  294.  
  295.  
  296. -- part 5 (button)
  297. -- low flags: 00
  298. -- high flags: 0000
  299. -- rect: left=59 top=59 right=91 bottom=248
  300. -- title width / last selected line: 0
  301. -- icon id / first selected line: 0 / 0
  302. -- text alignment: 1
  303. -- font id: 0
  304. -- text size: 12
  305. -- style flags: 0
  306. -- line height: 16
  307. -- part name: 
  308. ----- HyperTalk script -----
  309. on mouseDown
  310.   if visible of cd fld "freeware" then click at the loc of cd fld "freeware"
  311.   if hilite of me then
  312.     repeat 2
  313.       set hilite of me to false
  314.       set hilite of me to true
  315.     end repeat
  316.     show cd btn "blank"
  317.     set hilite of me to false
  318.   else
  319.     set hilite of me to true
  320.     hide cd btn "blank"
  321.   end if
  322. end mouseDown
  323.  
  324.  
  325. -- part 6 (button)
  326. -- low flags: 00
  327. -- high flags: A000
  328. -- rect: left=60 top=176 right=194 bottom=246
  329. -- title width / last selected line: 0
  330. -- icon id / first selected line: 0 / 0
  331. -- text alignment: 0
  332. -- font id: 0
  333. -- text size: 12
  334. -- style flags: 0
  335. -- line height: 16
  336. -- part name: About STaK-X...
  337. ----- HyperTalk script -----
  338. on hideMe
  339.   repeat 3
  340.     set hilite of me to false
  341.     set hilite of me to true
  342.   end repeat
  343.   set hilite of me to false
  344.   hide cd fld "About"
  345.   click at the loc of bg btn "More FreeWare & S/W..."
  346. end hideMe
  347. on mouseUp
  348.   hideMe
  349. end mouseUp
  350. on mouseDown
  351.   show cd fld "About"
  352. end mouseDown
  353. on mouseLeave
  354.   hide cd fld "About"
  355. end mouseLeave
  356.